package base;

import org.junit.Test;

public class MyStack {
    private int[] stack;
    private int pointer=0;

    public MyStack(int len) {
        stack=new int[len];
    }
    public int add(int e){
        stack[pointer]=e;
        pointer++;
        return 1;
    }
    public int pull(){
        pointer--;
        return stack[pointer];


    }

    public static void main(String[] args) {
        MyStack stack=new MyStack(5);
        stack.add(1);
        stack.add(2);
        stack.add(3);
        System.out.println(stack.pull());
        System.out.println(stack.pull());
        System.out.println(stack.pull());
    }
}
